<script>
	import siteInfo from './common/siteinfo';
	import utils from '@/common/utils';
	export default {
		globalData: {
			siteInfo,
			onImgurl: 'https://app.7yu.cc/static/miniapp/',
			//api: require('./common/config.js'),
		},
		//api: require('./common/config.js'),
		onLaunch: function(options) {
			// #ifdef H5
			if (!siteInfo.isDev) {
				let params = utils.getUrlParams(location.href);
				this.globalData.siteInfo.uniacid = params.uniacid;
				this.globalData.siteInfo.eid = params.eid;
				console.log('%c params ', 'color: white; background-color: #f00000', params);
				this.getLoginInfo();
			} else {
				// this.globalData.siteInfo.uniacid = 6
			}
			// #endif
			// #ifdef MP
			this.autoUpdate()
			// #endif
			// #ifdef MP-ALIPAY
			if (options.query && options.query.qrCode) {
			      this.globalData.siteInfo.qrCode = options.query.qrCode;
			    } 
			// #endif
			// console.log('App Launch')
			// this.util.wxAuthorize();
		},
		methods: {
			// #ifdef MP
			autoUpdate() {
				const updateManager = uni.getUpdateManager();
				updateManager.onCheckForUpdate(res => {
					if (res.hasUpdate) {
						uni.showModal({
							title: '更新提示',
							confirmText: "确定更新",
							showCancel: false,
							content: '新版本已经准备好，是否重启应用？',
							success: res => {
								if (res.confirm) {
									//2. 用户确定下载更新小程序，小程序下载及更新静默进行
									this.downLoadAndUpdate(updateManager)
								} else {
									uni.showModal({
										title: '温馨提示~',
										content: '本次版本更新涉及到新的功能添加，旧版本无法正常访问的哦~',
										showCancel: false,
										confirmText: "确定更新",
										success: res => {
											if (res.confirm) {
												this.downLoadAndUpdate(updateManager)
											}
										}
									})
								}
							}
						})
					}
				});
			},
			downLoadAndUpdate: function(updateManager) {
				uni.showLoading();
				//静默下载更新小程序新版本
				updateManager.onUpdateReady(function() {
					uni.hideLoading()
					updateManager.applyUpdate()
				})
				updateManager.onUpdateFailed(function() {
					uni.hideLoading()
					// 新的版本下载失败
					uni.showModal({
						title: '已经有新版本了哟~',
						content: '新版本已经上线啦~，请您删除当前小程序，重新搜索打开哟~',
					})
				})
			},
			// #endif
		},
		onShow: async function(data) {
			if (data) {
				if (data.hasOwnProperty('referrerInfo')) {
					if (data.referrerInfo.appId == 'wxeb490c6f9b154ef9') {
						if (data.referrerInfo.extraData) {
							let res = await this.util.request({
								url: this.api.jhhyk,
								method: 'POST',
								data: {
									activate_ticket: data.referrerInfo.extraData.activate_ticket,
									card_id: data.referrerInfo.extraData.card_id,
									code: data.referrerInfo.extraData.code,
									userId: this.$store.state.user.userId
								}
							});
							console.log('%c extraData ', 'color: white; background-color: #34aaff', data.referrerInfo,
								res.data);
						}
					}
				}
			}
		},
		onHide: function() {},

	};
</script>

<style lang="scss">
	@import './common/styles/index.css';
	
	/*每个页面公共css */
	.fowe800 {
		font-weight: 800;
	}
	
	.fowe600 {
		font-weight: 600;
	}
	
	.fofa {
		font-family: initial;
	}
	
	.dis {
		display: flex;
	}
	
	.disAl {
		align-items: center;
	}
	
	.disJuC {
		justify-content: center;
	}
	
	.disJuB {
		justify-content: space-between;
	}
	
	.flwa {
		flex-wrap: wrap;
	}
	
	.fleDir {
		flex-direction: column;
	}
	
	.wid100 {
		width: 100%;
	}
	
	.wid95 {
		width: 95%;
	}
	
	.wid90 {
		width: 90%;
	}
	
	.wid87 {
		width: 87%;
	}
	
	.wid85 {
		width: 85%;
	}
	
	.wid80 {
		width: 80%;
	}
	
	.wid50 {
		width: 50%;
	}
	
	.wid33 {
		width: 33.33%;
	}
	
	.wid30 {
		width: 30%;
	}
	
	.wid70 {
		width: 70%;
	}
	
	.wid20 {
		width: 20%;
	}
	
	.wid25 {
		width: 25%;
	}
	
	.hei100 {
		height: 100%;
	}
	
	.hei80 {
		height: 80rpx;
	}
	
	.hei86 {
		height: 86rpx;
	}
	
	.hei87 {
		height: 87rpx;
	}
	
	.hei60 {
		height: 60rpx;
	}
	
	.hei50 {
		height: 50rpx;
	}
	
	.hei20 {
		height: 20rpx;
	}
	
	.wh100 {
		width: 100%;
		height: 100%;
	}
	
	.mar {
		margin: auto;
	}
	
	.mar20 {
		margin: 20rpx auto;
	}
	
	.mar-left10 {
		margin-left: 10rpx;
	}
	
	.mar-right10 {
		margin-right: 10rpx;
	}
	
	.mar-top10 {
		margin-top: 10rpx;
	}
	
	.mar-bott10 {
		margin-bottom: 10rpx;
	}
	
	.mar-left20 {
		margin-left: 20rpx;
	}
	
	.mar-right20 {
		margin-right: 20rpx;
	}
	
	.mar-top20 {
		margin-top: 20rpx;
	}
	
	.mar-bott20 {
		margin-bottom: 20rpx;
	}
	
	.mar-left30 {
		margin-left: 30rpx;
	}
	
	.mar-right30 {
		margin-right: 30rpx;
	}
	
	.mar-top30 {
		margin-top: 30rpx;
	}
	
	.mar-top15 {
		margin-top: 15rpx;
	}
	
	.mar-bott30 {
		margin-bottom: 30rpx;
	}
	
	.mar-top40 {
		margin-top: 40rpx;
	}
	
	.textCen {
		text-align: center;
	}
	
	.foSi60 {
		font-size: 60rpx;
	}
	
	.foSi50 {
		font-size: 50rpx;
	}
	
	.foSi45 {
		font-size: 45rpx;
	}
	
	.foSi40 {
		font-size: 40rpx;
	}
	
	.foSi35 {
		font-size: 35rpx;
	}
	
	.foSi32 {
		font-size: 32rpx;
	}
	
	.foSi30 {
		font-size: 30rpx;
	}
	
	.foSi28 {
		font-size: 28rpx;
	}
	
	.foSi25 {
		font-size: 25rpx;
	}
	
	.foSi22 {
		font-size: 22rpx;
	}
	
	.foSi20 {
		font-size: 20rpx;
	}
	
	.foSi18 {
		font-size: 18rpx;
	}
	
	.foSi15 {
		font-size: 15rpx;
	}
	
	.foSi13 {
		font-size: 13rpx;
	}
	
	.borRad10 {
		border-radius: 10rpx;
	}
	
	.borRad20 {
		border-radius: 20rpx;
	}
	
	.borRad30 {
		border-radius: 30rpx;
	}
	
	.borRad40 {
		border-radius: 40rpx;
	}
	
	.borRad60 {
		border-radius: 60rpx;
	}
	
	.borRad50 {
		border-radius: 50%;
	}
	
	.coFFF {
		color: #fff;
	}
	
	.bacFFF {
		background-color: #fff;
	}
	
	.xhx {
		height: 1rpx;
		background-color: #F0F0F0;
	}
	
	.poFix {
		position: fixed;
	}
	
	.poAbs {
		position: absolute;
	}
	
	.poRel {
		position: relative;
	}
	
	.overflowHidden {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	
	.webkitLineClamp {
		overflow: hidden;
		word-break: break-all;
		/* break-all(允许在单词内换行。) */
		text-overflow: ellipsis;
		/* 超出部分省略号 */
		display: -webkit-box;
		/** 对象作为伸缩盒子模型显示 **/
		-webkit-box-orient: vertical;
		/** 设置或检索伸缩盒对象的子元素的排列方式 **/
		-webkit-line-clamp: 2;
		/** 显示的行数 **/
	}
	
	.webkitLineClamp3 {
		overflow: hidden;
		word-break: break-all;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		white-space: pre-line !important;
	}
	
	::-webkit-scrollbar {
		display: none;
		width: 0 !important;
		height: 0 !important;
		-webkit-appearance: none;
		background: transparent;
		color: transparent;
	}
	
	button {
		padding: 0;
		margin: 0;
		padding-left: 0;
		padding-right: 0;
		line-height: 0;
	}
	
	button::after {
		border: none;
	}
	
	/* // 点击时样式 */
	.button-hover {
		color: rgba(0, 0, 0, 0.6);
		background-color: #fff;
	}

	/* #ifdef H5 */
	uni-page-head {
		display: none;
	}

	/* #endif */
	
	/* 在main.wxss中写  main.wxml引入swiper组件 */
	/* 修改dot形状 */
	.swiper .wx-swiper-dots .wx-swiper-dot{
		margin-bottom: 50rpx !important;
	}
</style>
